package com.example.administrator.znjt.data;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

/**
 * Created by Administrator on 2017/5/11.
 */

public class EnvironmentalDBHelper extends SQLiteOpenHelper {

    public static final String DATABASE_NAME="environmental.db";
    public static final int DATABASE_VERSION=1;
    public static final String KEY_TEMPERATURE="temperature";
    public static final String KEY_HUMIDITY="humidity";
    public static final String KEY_LIGHT_INTENSITY="LightIntensity";
    public static final String KEY_CO2="co2";
    public static final String KEY_PM="pm";
    public static final String KEY_STATUS="Status";
    public static final String KEY_TIME="createAt";
    public static final String[] KEY_SET = {
            KEY_TEMPERATURE,
            KEY_HUMIDITY,
            KEY_LIGHT_INTENSITY,
            KEY_CO2,
            KEY_PM,
            KEY_STATUS
    };
    public static final String TABLE_NAME="environmental";
    private static final String CREATE_TABLE="CREATE TABLE "+TABLE_NAME+
            "(_id INTEGER PRIMARY KEY AUTOINCREMENT,"+
            KEY_TEMPERATURE+" Long,"+
            KEY_HUMIDITY+" Long," +
            KEY_LIGHT_INTENSITY+" Long,"+
            KEY_CO2+" Long,"+
            KEY_PM+" Long," +
            KEY_STATUS+" Long," +
            KEY_TIME+" Long);";

    public EnvironmentalDBHelper(Context context) {
            super(context,DATABASE_NAME, null, DATABASE_VERSION);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        db.execSQL(CREATE_TABLE);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

    }


}
